<?php if(!empty($report)){?>
<style>
.info_table{
	border-collapse:collapse;
	font-size:12px;
}
.info_table tr th{
	border:1.5px solid;
}
.info_table tr.per_list td{
	border:1px solid;
}
.excle_title{
	border:0px;
	text-align:center;
}
.info_table tr.per_list td.ltd{
	border-left:1.5px solid;
}
.info_table tr.per_list td.rtd{
	border-right:1.5px solid;
}
.info_table tr.per_list td.btd{
	border-bottom:1.5px solid;
}
.info_table tr.per_list td.normal_td{
	border:1px solid;
}
</style>
<?php }?>
<?php if(empty($report)){?>
<div class="right_side_operate_area">
	<div class="right_side_title left">
		<h2>企业载体租赁信息汇总</h2>
	</div>
	<?php  
		if($showpage == 1) {
			if(isset($paging)){ echo $this->renderElement('pagination',$paging);} 
		}
    	echo '<div class="right back_btn">';
		echo $html->link("生成文件","#",array("onclick"=>"generate()"));
		echo '</div>';
	?>
    <div class="right search_box">
		<form onsubmit="return searchtech()">
	    	<div class="left search_text">
	    		<?php echo $form->text('company.keyword',array('placeholder'=>'查询指定天数内到期','value'=>$deadlinedays, 
	    													   'id'=>'search', 'class'=>'text_box'));?>
	    	</div>
	        <div class="left search_btn"><input type="submit" value=""/></div>
        </form>
        <div class="clear"></div>
    </div>
    <div class="clear"></div>
</div>
<div class="right_side_scollbar">
    <div class="detail_info_panel">
        <div class="items_list">
<?php }?>
        	<table class="info_table">
        	<?php 
        		if(!empty($report)){
        			echo "<tr ><td class='excle_title' colspan='5'><h3>企业载体租赁信息汇总</h3></td></tr>";
        		}
        	?>
            	<tr>
                    <th>企业名称</th>
                    <th>入驻划区</th>
                    <th>具体位置</th>
                    <th>载体面积（㎡）</th>
                    <th>租赁期限</th>
                    <th>租赁金额（￥）</th>
                </tr>
                <?php 
                if($companys){
                	$index = 0;
                	$countcom = count($companys);
					foreach($companys as $company){
						$index++;
						$id = $company["SearchCompany"]["id"];
						$company_name = $company["SearchCompany"]["company_name"];
						$showcname = $company_name;
						if(!empty($report)){
							$showcname = $company_name;
						}else{
							$showcname = $html->link($str->sub_len($showcname,20),"/companys/showinfosummary/".$id,array("title"=>$company_name),null);
						}
						$objcarleas = $company["CompCarrierlease"];
						$objcarleacount = count($objcarleas);
						$i=0;
						$btd = "";
						if($countcom == $index){
							$btd = "btd";
						}
						if(!empty($objcarleas)){
							foreach($objcarleas as $carrierlease){
								$forbid = $forbids[$carrierlease['forbid']];
								$location = $carrierlease["location"];
								echo "<tr class='per_list'>";
								if($i == 0){
									echo "<td class='ltd ".$btd."' rowspan='".$objcarleacount."'>".$showcname."</td>";
								}
								echo "<td class='".$btd."'>".$forbid."</td>";
								if(!empty($report)){
									echo "<td class='".$btd."'>".$location."</td>";
								}else{
									echo "<td title=".$location.">".$str->sub_len($location,20)."</td>";
								}
								echo "<td class='".$btd."'>".$carrierlease["area"]."</td>";
								$starttime = date("Y/m/d",strtotime($carrierlease["starttime"]));
								$deadline = date("Y/m/d",strtotime($carrierlease["deadline"]));
								echo "<td class='".$btd."'>".$starttime."~".$deadline."</td>";
								echo "<td class='rtd ".$btd."'>".$carrierlease["rent"]."</td>";
								echo "</tr>";
								$i++;
							}
						}
						if($i==0){
							echo "<tr class='per_list'>";
							echo "<td class='ltd ".$btd."'>".$showcname."</td>";
							echo "<td class='normal_td ".$btd."'></td><td class='normal_td ".$btd."'></td>
								  <td class='normal_td ".$btd."'></td><td class='rtd ".$btd."'></td>";
							echo "</tr>";
						}
						
					}
				}?>
            </table>
<?php if(empty($report)){?>
		</div>
    </div>
</div>
<script>
var webpath=$("#getpath").attr('href');
if($("#search").val()!=""){
	$("#search").focus();
}
function searchtech()
{	
	var urlpath=webpath+"searchs/carrierlease?seach=all";
	var search=$("#search").val();
	if(search==""){
		location.href=urlpath;
	}else{
		if(search.trim()!=""){
			urlpath+="&deadlinedays="+search.trim();
		}
		location.href=urlpath;
	}
	return false;
}
function generate(){
	deadlinedays = $("#search").val();
	location.href=webpath+"searchs/carrierlease/1?seach=all&deadlinedays="+deadlinedays;
}

funPlaceholder(document.getElementById("search"));
</script>
<?php }?>